/*
 * CTDR_GridField.h
 *
 *  Created on: 1 déc. 2010
 *      Author: mbenoit
 */
//////////////////////////////////////////////////////////////////////////
// Source file : class CTDR_GridField					//
// This class represent the CTDR_GridField in the CZT detector. CTDR_GridField 	//
// data are read from a ROOT  file and stored in a TTree.This class pass//
// to the simulation the value of the CTDR_GridField at a position x,y,z,	//
// on demand. This class is similar to the class Detecteur.		//
//////////////////////////////////////////////////////////////////////////

#ifndef CTDR_GridField_H_DEF
#define CTDR_GridField_H_DEF

#include "TTree.h"
#include "TNtupleD.h"

#include "TFile.h"
#include "TClass.h"
#include "CTDR_Field.h"

class CTDR_GridField: public CTDR_Field {

      private:
          TNtupleD *TEx; // x component of the GridField data tree
	      TNtupleD *TEy; // y component of the GridField data tree
	      TNtupleD *TEz; // z component of the GridField data tree


          double x_Ex; // Variable where Tree's data are read
	      double y_Ex;
	      double z_Ex;
	      double x_Ey;
	      double y_Ey;
	      double z_Ey;
	      double x_Ez;
	      double y_Ez;
	      double z_Ez;
	      double E_Ex;
	      double E_Ey;
	      double E_Ez;
		  int NDivx; // number of slices in x
		  int NDivy; // number of slices in y
	      int NDivz; // number of slices in z

		  double lowx; // Lowest x point of a cube
		  double lowy; // Lowest y point of a cube
		  double lowz; // Lowest z point of a cube
		  double highx; // Highest x point of a cube
		  double highy; // Highest y point of a cube
		  double highz; // Highest z point of a cube

      public:
             CTDR_GridField(TFile &Fichier,int NdivX,int NdivY, int NdivZ,double LX, double LY, double LZ);
             void SetChamp(double xx, double yy ,double zz);
             void Interpole(double x, double y , double z);
     		 void SetPoints(double x, double y, double z);
     		 Long64_t Hash(double x ,double y , double z);

     		 //ClassDef(CTDR_GridField,0) // The electric GridField
             };

#endif

